<template>
  <view class="page">
    <u-parse v-if="type != 'community'" :content="content" />
    <u-empty
      v-else
      :icon="webSrc('/assets/web_img/empty.png')"
      width="162"
      height="162"
      text="暂未开放，敬请期待"
      textColor="#bababa"
    />
  </view>
</template>

<script>
import { qiuAgreement } from "@/request/qiuApi.js";
export default {
  data() {
    return {
      type: "", // 服务条款 order 社群 community 关于我们 platform
      content: "", // 内容
    };
  },
  onLoad(e) {
    this.type = e.type;
    if (e.type == "order") {
      this.getData();
    } else if (e.type == "platform") {
      this.getData();
    } else if (e.type == "community") {
      uni.setNavigationBarTitle({
        title: "社群",
      });
    }
  },
  methods: {
    // 获取协议
    getData() {
      qiuAgreement().then((res) => {
        if (res.code == 1) {
          let info = res.data.find((i) => i.type == this.type);
          if (info) {
            this.content = info.content;
            uni.setNavigationBarTitle({
              title: info.title,
            });
          }
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.page {
  word-break: break-all;
  padding: 20rpx;
  .empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #bababa;
    font-weight: 400;
    font-size: 32rpx;
    line-height: 44rpx;
  }
}
</style>
